import type { FormField } from '@/stores/formDesigner'

const Desc: FormField = {
  id: null,
  name: 'IFormTable',
  nickName: '表格',
  type: 'table',
  icon: 'IFormTable',
  parentId: null,
  slot: null,
  isShow: true,
  attrs: {
    // 基础属性
    label: '表格',
    required: false,

    // 表格数据
    tableData: [],
    columns: [],

    // 表格配置
    border: true,
    stripe: false,
    size: 'default', // large, default, small
    height: undefined,
    maxHeight: undefined,

    // 表格功能
    showHeader: true,
    highlightCurrentRow: false,
    rowKey: 'id',
    emptyText: '暂无数据',
    showSummary: false,
    sumText: '合计',
    summaryMethod: undefined,

    // 选择功能
    selectable: false,
    reserveSelection: false,

    // 排序功能
    sortable: false,
    sortBy: '',
    sortOrders: ['ascending', 'descending'],

    // 过滤功能
    filterable: false,
    filteredValue: [],

    // 分页功能
    pagination: false,
    pageSize: 10,
    currentPage: 1,
    total: 0,

    // 样式相关
    tableStyle: {},
    tableClass: '',
    headerCellStyle: {},
    cellStyle: {},

    // 合并单元格相关
    spanMethod: undefined, // 合并行或列的计算方法

    // 事件
    onSelect: undefined,
    onSelectAll: undefined,
    onSelectionChange: undefined,
    onRowClick: undefined,
    onRowDblclick: undefined,
    onRowContextmenu: undefined,
    onSortChange: undefined,
    onFilterChange: undefined,
    onCurrentChange: undefined,
    onHeaderDragend: undefined,
    onExpandChange: undefined
  },
  style: {
    width: '100%',
    height: '100%',
    x: 0,
    y: 0,
  },
  validation: false,
}

export default Desc
